import { useEffect, useState } from "react"

const useFetch = (url, { data, headers, method }) => {
    const [res, setRes] = useState()

    useEffect(() => {
        fetch(url, {
            headers: {
                authorization: `Bearer ${localStorage.getItem('token')}`
            }
        }).then(res => res.json()).then(res => setRes(res))
    }, [])

    return res
}